package com.sfh.cpc.note;

import android.content.Context;
import android.graphics.Color;
import android.widget.LinearLayout;

import com.sfh.cpc.com.entity.ENote;
import com.sfh.cpc.com.widget.WidgetMassContent;
import com.sfh.cpc.com.widget.WidgetMassUserInfo;

/**
 * 功能描述: TODO
 *
 * @author SunFeihu 孙飞虎
 * @date 2018/8/29
 */
public class NoteInfoView extends LinearLayout {

    WidgetMassUserInfo userInfo;
    WidgetMassContent massContent;

    public NoteInfoView(Context context) {
        super(context);
        init();
    }

    private void init() {
        this.setOrientation(VERTICAL);
        this.userInfo = new WidgetMassUserInfo(this.getContext());
        this.userInfo.setBackgroundColor(Color.WHITE);
        this.userInfo.setPadding(20,10,20,10);
        this.addView(userInfo);

        this.massContent = new WidgetMassContent(this.getContext());
        this.massContent.setBackgroundColor(Color.WHITE);
        this.massContent.setPadding(20,10,20,20);
        this.addView(massContent);
        this.setPadding(0,0,0,25);
    }

    public void showData(ENote note) {

        this.userInfo.showData(note.getUser());
        this.massContent.showData(note);
    }

    public void updateMsgSize() {
        this.massContent.updateMessageSize();
    }
}
